# coding:utf-8
with open('log.txt','r',encoding='utf-8')as f:
    line=f.read().split('\n')
    with open('blog.csv', 'w', encoding='utf-8') as w:
        for i in line:
            try:
                title=i.split(',')[1][6:]
                if title in [
                    'RouterOS',
                    'WEB SERVICE',
                    'Welcome to nginx!',
                    'RouterOS router configuration page',
                    '404 Not Found',
                    'Welcome to CentOS',
                    'DVR Components Download',
                    '404 File Not Found',
                    'Hello! Welcome to Synology Web Station!',

                ]or any(char in title for char in ('F6', 'f',':','Login','HTTP','IIS','404','登录','停管','阻断')):
                    continue
                # print(title)
                # if '博客' in title:
                #     with open('blog.csv','w',encoding='utf-8')as w:
                #         w.write(f'{i.split(',')[0][3:]},{i.split(',')[1][6:]}\n')
                #         print(i.split(',')[1][6:])

                if any('\u4e00' <= char <= '\u9fff' for char in title):
                        w.write(f'{i.split(',')[0][3:]},{i.split(',')[1][6:]}\n')
                        print(i.split(',')[1][6:])
            except Exception as e:
                pass